<?php
/**
 * Created by PhpStorm.
 * User: gyq
 * Date: 2018/11/4
 * Time: 8:45
 */

namespace app\api\validate;


class IDCollection extends BaseValidate
{
    protected $message = [
        'ids' => 'ids必须是以逗号分隔正整数'
    ];
    protected $rule = [
        'ids' => 'require|checkIds'
    ];
    protected function checkIds($ids)
    {
        $value = explode(',', $ids);
        if (!$value) {
            return false;
        }
        foreach ($value as $v) {
            if(!$this->isPositiveInteger($v)) {
                return false;
            }
        }
        return true;
    }
}